"""
模型定义：

class Student(models.Model):
    name = models.CharField(max_length=20)
    gender = models.IntegerField()
    age = models.IntegerField()
    birth = models.DateTimeField()
    cellphone = models.CharField(max_length=20)

"""

import random
from datetime import datetime

import pytz


def populate_students():
    random.seed(20180723)
    tz = pytz.timezone('Asia/Chongqing')

    for i in range(10000):
        name = 'ZX%s' % i
        gender = random.choice([0,1,0,1,0,1])
        age = random.randint(18, 30)
        num = random.randint(10000000, 99999999)
        year = random.randint(1970, 1990)
        month = random.randint(1, 12)
        day = random.randint(1, 28)
        hour = random.randint(0, 23)
        minute = random.randint(0, 59)
        second = random.randint(0, 59)
        birth = datetime(year, month, day, hour, minute, second, tzinfo=tz)
        cellphone = '186%s' % num
        print('%s,%s,%s,%s,%s' % (name, gender, age, birth.strftime('%F %T'), cellphone))


if __name__ == '__main__':

    populate_students()
